package com.test.springboot;

import com.test.springboot.model.User;
import com.test.springboot.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author chenxubing
 * @version $Id: ApplicationMain.java, v 0.1 2018-11-09 3:22 PM chenxubing Exp $$
 */
@SpringBootApplication
@RestController
public class ApplicationMain {
    @Autowired
    private UserService userService;

    @PostMapping("/send")
    @ResponseStatus(HttpStatus.ACCEPTED)
    public void send(@RequestBody User user) {
        user.setTimestamp(System.currentTimeMillis());
        userService.send(user);
    }

    public static void main(String[] args) {
        SpringApplication.run(ApplicationMain.class, args);
    }
}
